#ifndef __XMODEM_H__
#define __XMODEM_H__

#include "user_config.h"
#include "stdbool.h"

#define 	XMODEM_OK			(0)
#define		XMODEM_ERR			(-1)


typedef enum _miio_xmodem_type {
	XMODEM = 0,
	XMODEM_1K,
} miio_xmodem_type;

typedef struct _miio_xmodem_t{
	miio_xmodem_type type;

	/*    xmodem -  134 bytes : 1[head] + 1[num] + 1[~num] +  128[data] + 2[crc] + 1[null] */
	/* xmodem-1k - 1030 bytes : 1[head] + 1[num] + 1[~num] + 1024[data] + 2[crc] + 1[null] */
	unsigned char xbuff[256];
} miio_xmodem_t;

int xmodem_recv_data(void);

bool app_func_is_ota_busy(void);
int arch_erase_func(void);
int arch_ota_func(unsigned char *pbuf, unsigned int len, unsigned int sum);
#endif /* USER_OTA_ENABLE */

